package com.zhang.order.service.impl;

import com.zhang.order.entity.OrderOperateHistory;
import com.zhang.order.mapper.OrderOperateHistoryMapper;
import com.zhang.order.service.IOrderOperateHistoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 * 订单操作历史记录 服务实现类
 * </p>
 *
 * @author 创世神
 * @since 2023-12-05
 */
@Service
public class OrderOperateHistoryServiceImpl extends ServiceImpl<OrderOperateHistoryMapper, OrderOperateHistory> implements IOrderOperateHistoryService {

    @Override
    public void addOrderPayHistory(OrderOperateHistory orderOperateHistory) {
        orderOperateHistory.setOrderStatus(1);
        orderOperateHistory.setOperateMan("系统");
        orderOperateHistory.setNote("用户支付订单");
        orderOperateHistory.setCreateTime(LocalDateTime.now());
        save(orderOperateHistory);
    }

    @Override
    public void addOrderReceiveHistory(OrderOperateHistory orderOperateHistory) {
        orderOperateHistory.setOrderStatus(3);
        orderOperateHistory.setOperateMan("用户");
        orderOperateHistory.setNote("用户确认收货");
        orderOperateHistory.setCreateTime(LocalDateTime.now());
        save(orderOperateHistory);
    }

    @Override
    public void addOrderSendHistory(OrderOperateHistory orderOperateHistory) {
        orderOperateHistory.setOrderStatus(2);
        orderOperateHistory.setOperateMan("管理员");
        orderOperateHistory.setNote("订单发货");
        orderOperateHistory.setCreateTime(LocalDateTime.now());
        save(orderOperateHistory);
    }

    @Override
    public void addOrderAppraiseHistory(OrderOperateHistory orderOperateHistory) {
        orderOperateHistory.setOperateMan("用户");
        orderOperateHistory.setNote("用户评价");
        orderOperateHistory.setCreateTime(LocalDateTime.now());
        save(orderOperateHistory);
    }

}
